package com.example.fairplay.newfpregistration.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.fairplay.newfpregistration.R;
import com.example.mylibrary.adapter.BasicAdapter;
import com.example.mylibrary.data.Item;
import com.example.mylibrary.data.ItemGrop;

import java.util.List;

/**
 * Created by fairplay on 2018/6/5.
 */

public class ItemGroupAdapter extends BasicAdapter<ItemGrop> {
    private List<ItemGrop> list;
    private Context mContext;
    public ItemGroupAdapter(Context mContext, List<ItemGrop> mList) {
        super(mContext,mList);
        this.list=mList;
        mContext=mContext;

    }

    @Override
    protected View getExtView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder=null;
        if(convertView!=null){
            viewHolder= (ViewHolder) convertView.getTag();

        }else {
            viewHolder=new ViewHolder();
            convertView=mInflater.inflate(R.layout.item_sort,null);
            convertView.setTag(viewHolder);
        }
        viewHolder.tv_name=convertView.findViewById(R.id.tv_name);
        viewHolder.tv_name.setText(String.valueOf(list.get(position).getGropNo()));
        return convertView;
    }

    class ViewHolder{
        public TextView tv_name;
    }
}
